package model

import (
	"gorm.io/gorm"
	"time"
)

type User struct {
	Id        uint32         `gorm:"column:id;type:int UNSIGNED;comment:ID;primaryKey;not null;" json:"id"`             // ID
	Mobile    string         `gorm:"column:mobile;type:char(11);comment:账号;not null;" json:"mobile"`                  // 账号
	Password  string         `gorm:"column:password;type:char(32);comment:密码;not null;" json:"password"`              // 密码
	Name      string         `gorm:"column:name;type:varchar(60);comment:昵称;not null;" json:"name"`                   // 昵称
	Image     string         `gorm:"column:image;type:varchar(300);comment:头像;not null;default:未设置;" json:"image"` // 头像
	CreatedAt time.Time      `gorm:"column:created_at;type:datetime(3);not null;default:CURRENT_TIMESTAMP(3);" json:"created_at"`
	UpdatedAt time.Time      `gorm:"column:updated_at;type:datetime(3);not null;default:CURRENT_TIMESTAMP(3);" json:"updated_at"`
	DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;type:datetime(3);default:NULL;" json:"deleted_at"`
}

func (u *User) TableName() string {
	return "user"
}
